package weaver.interfaces.gkgk.duss.utils;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author dusongsong
 * @date 2023年07月31日 09:52
 */
public class GkgkUtil extends BaseBean {
    /**
     * 判断是否是主合同
     *
     * @param htid
     * @return
     */
    public Map<String,String> getHtid(String htid) {
        RecordSet rs = new RecordSet();
        Map<String,String> map= new HashMap<String, String>();
        String zhtid = "";
        String bchtid = "";
        rs.executeQuery("select id,sfwbcht,yht from uf_httz where id in (" + htid + ")");
        while (rs.next()) {
            String id = Util.null2String(rs.getString("id"));
            String sfwbcht = Util.null2String(rs.getString("sfwbcht"));
            String yht = Util.null2String(rs.getString("yht"));
            if ("0".equals(sfwbcht)) {
                bchtid += "".equals(bchtid) ? yht : "," + yht;
            } else {
                zhtid += "".equals(zhtid) ? id : "," + id;
            }
        }
        map.put("zhtid",zhtid);
        map.put("bchtid",bchtid);
        return map;
    }

}
